//
//  AddressUpViewXin.m
//  FD
//
//  Created by xiaofang wang on 2019/1/7.
//  Copyright © 2019年 ZhiYuan Network. All rights reserved.
//

#import "AddressUpViewXin.h"
#import "NewAddressLabelTextField.h"
#import "NewAddressSexView.h" //男女
#define kContactLTFrame CGRectMake(0, 0, SCREEN_WIDTH, 50)
@interface AddressUpViewXin()

/**1.div*/
@property (nonatomic, strong) NewAddressSexView *sexView;

/**viewsArr*/
@property (nonatomic, strong) NSArray *viewArr;

@end

@implementation AddressUpViewXin
- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    
    if (self) {
        [self setupUI];
    }
    return self;
}

- (void)setupUI {
    self.backgroundColor = kMainLightGrayColor;
    
    [self addSubview:self.contactLT];
    [self addSubview:self.sexView];
    [self addSubview:self.phoneLT];
    self.viewArr = @[self.contactLT,self.sexView,self.phoneLT];
    
    
}

- (void)layoutSubviews {
    [super layoutSubviews];
    [self.viewArr mas_distributeViewsAlongAxis:MASAxisTypeVertical withFixedSpacing:1 leadSpacing:1 tailSpacing:1];
    [self.viewArr mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.mas_left);
        make.right.equalTo(self.mas_right);
    }];
}



#pragma mark - getter
- (NewAddressLabelTextField *)contactLT {
    if (!_contactLT) {
        
        NSString *lxrxmStr = NSLocalizedString(Home_put_your_contacts_name, @"请输入联系人姓名");
        _contactLT = [[NewAddressLabelTextField alloc] initWithFrame:kContactLTFrame title:NSLocalizedString(Home_contacts, @"联系人") placeHolder:lxrxmStr];
    }


    return _contactLT;
}
- (NewAddressSexView *)sexView {
    if (!_sexView) {
        _sexView = [[NewAddressSexView alloc] initWithFrame:kContactLTFrame];
        FDWeakSelf;
        
        _sexView.clickSexViewBlock = ^(NSNumber * _Nonnull sexNumber) {
            //回调
            if (weakSelf.addressUPViewXinClickSexViewBlock) {
                weakSelf.addressUPViewXinClickSexViewBlock(sexNumber);
            }
        };
    }
    return _sexView;
}

- (NewAddressLabelTextField *)phoneLT {
    if (!_phoneLT) {
        _phoneLT = [[NewAddressLabelTextField alloc] initWithFrame:kContactLTFrame title:NSLocalizedString(Home_phone, @"电话") placeHolder:NSLocalizedString(Home_inputPhone, @"请输入联系电话")];
        _phoneLT.textField.keyboardType = UIKeyboardTypeNumberPad; //2019-2-25数字键盘
    }
    return _phoneLT;
}


#pragma mark - xxx
/**修改性别按钮选中样式
 0 先生
 1 女士
 */
- (void)changeSex:(NSNumber *)sex {
   
    [self.sexView updateSexBtnWithSexNumber:sex];
}

@end
